// Project: Salient
// http://salient.codeplex.com
// 
// Copyright 2010, Sky Sanders <sky at skysanders.net>
// Dual licensed under the MIT or GPL Version 2 licenses.
// http://salient.codeplex.com/license
// 
// Date: April 25 2010 

#region

using System.Security.Principal;

#endregion

namespace Salient.Web.Security
{
    ///<summary>
    ///</summary>
    public class AccessControlIdentity : IIdentity
    {
        private readonly IIdentity _innerIdentity;

        ///<summary>
        ///</summary>
        ///<param name="identity"></param>
        public AccessControlIdentity(IIdentity identity)
        {
            _innerIdentity = identity;
        }

        ///<summary>
        ///</summary>
        public bool Authenticated { get; set; }

        #region IIdentity Members

        /// <summary>
        /// Gets the name of the current user.
        /// </summary>
        /// <returns>
        /// The name of the user on whose behalf the code is running.
        /// </returns>
        public string Name
        {
            get { return _innerIdentity.Name; }
        }

        /// <summary>
        /// Gets the type of authentication used.
        /// </summary>
        /// <returns>
        /// The type of authentication used to identify the user.
        /// </returns>
        public string AuthenticationType
        {
            get { return _innerIdentity.AuthenticationType; }
        }

        /// <summary>
        /// Gets a value that indicates whether the user has been authenticated.
        /// </summary>
        /// <returns>
        /// true if the user was authenticated; otherwise, false.
        /// </returns>
        public bool IsAuthenticated
        {
            get { return Authenticated; }
        }

        #endregion
    }
}